import matplotlib
import matplotlib.font_manager as fm
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
plt.style.use('/REDACTED/fairness/code/config/fairness.mplstyle')
fe = fm.FontEntry(
    fname='/REDACTED/fairness/code/config/fonts/cmunrm.ttf',
    name='latex')
fm.fontManager.ttflist.insert(0, fe)
matplotlib.rcParams['font.family'] = fe.name

stanford_palette = ['#f0f4f5', 
                    '#d0d8da', 
                    '#aabeC6', 
                    '#009abb', 
                    '#007c92', 
                    '#3182bd',
                    '#a1d99b', 
                    '#80982a', 
                    '#31a354', 
                    '#b96d12', 
                    '#53284f', 
                    '#5e3032',
                    '#8c1515', 
                    '#dddddd', 
                    '#cccccc', 
                    '#999999', 
                    '#666666', 
                    '#333333',
                    '#000000', 
                    '#bcbddc',
                    '#9ecae1',
                    '#756bb1']
color_codes = ['background blue', 
               'gray blue', 
               'dark gray-blue', 
               'accent blue', 
               'link blue', 
               'dark blue',
               'light green', 
               'bright green', 
               'dark green', 
               'orange', 
               'purple', 
               'maroon',
               'cardinal red', 
               'line gray', 
               'light gray', 
               'gray', 
               'med gray', 
               'text gray',
               'black', 
               'light purple',
               'light blue',
               'dark purple']
cdict = dict(zip(color_codes, [mcolors.to_rgba(c) for c in stanford_palette]))
mcolors.get_named_colors_mapping().update(cdict)



def cmapAC():
    cmap = mcolors.LinearSegmentedColormap.from_list("",["accent blue","background blue","cardinal_red"])
    return cmap

def cdictACEITC():
    return {270:{'color':'accent blue','alpha':1},271:{'color':'gray blue','alpha':0.4}}

def cdictBlackNonBlack():
    return {'Black':{'color':'purple','alpha':1},'non-Black':{'color':'purple','alpha':0.4}}

def cdictEITCNon():
    return {'eitc':{'color':'dark green','alpha':1},'non':{'color':'light green','alpha':0.8}}

def cdictOracle():
    return {'U_Oracle':{'color':'light blue','linestyle':'-'},'R_Oracle':{'color':'dark blue','linestyle':'--'}}

def cdictURF():
    return {'U_RF_Class':{'color':'light green','linestyle':'-'},'U_RF_Reg':{'color':'light purple','linestyle':'-'}}

def cdictRRF():
    return {'R_RF_Class':{'color':'dark green','linestyle':'--'},'R_RF_Reg':{'color':'dark purple','linestyle':'--'}}
